Let be a spherical volume of radius that completely encloses all charges, meaning the charge density vanishes for all . Without loss of generality, we place the coordinate origin at the center of the sphere . According to Coulomb's law, the electric field at any field point inside the sphere is given by the volume integral over the source coordinates :
We want to evaluate the volume integral of over the entire sphere :
Since the region of integration is bounded and the charge distribution is well-behaved, we can apply Fubini's theorem to switch the order of the volume integrals over and :
Let us denote the inner vector integral as :
We recognize that the integrand can be expressed as the negative gradient with respect to the field point :
Substituting this identity into and applying a corollary of the divergence theorem (converting a volume integral of a gradient into a closed surface integral), we obtain:
where represents the bounding spherical surface at , and is the outward unit normal vector. On this spherical surface, the field point is (where is the radial unit vector ), and the area element is . Thus, the integral becomes
Because all charges are enclosed within the sphere, the source point always lies inside (), while the field point in the surface integral lies exactly on the boundary (). Since , we can expand the reciprocal distance into a series of Legendre polynomials:
where is the angle between and .
To evaluate the solid angle integral, we temporarily align the -axis along the direction of , making (the standard polar angle). The unit vector expands in Cartesian components as:
Integrating over the azimuthal angle from to , the terms containing and vanish identically due to periodicity. The only surviving component is along the direction (which is the direction of ):
Noting that , we invoke the orthogonality condition for Legendre polynomials:
Hence, only the term yields a non-zero contribution to the infinite series:
Substituting this result back into the expression for , the radius cancels out smoothly:
We now feed back into our original total electric field volume integral:
By definition, the total electric dipole moment of the localized charge distribution with respect to our chosen origin is: